package com.ruoyi.aitcommon.function;

import java.util.Objects;
import java.util.function.Function;

/**
 * 仿照 BiFunction,增加了异常抛出
 * @param <T>
 * @param <U>
 * @param <R>
 */
@FunctionalInterface
public interface BiFunctionEx<T, U, R> {

    R apply(T t, U u) throws Exception;

    default <V> BiFunctionEx<T, U, V> andThen(Function<? super R, ? extends V> after) {
        Objects.requireNonNull(after);
        return (T t, U u) -> after.apply(apply(t, u));
    }
}